<?php

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use kartik\select2\Select2;

if(!is_array($model->group_num)){
    $model->group_num = json_decode($model->group_num);
}

?>

<div class="member-form">

    <?php $form = ActiveForm::begin([
                                     'options' => ['enctype' => 'multipart/form-data',],
                                     'layout' => 'horizontal',
                                     'fieldConfig' => [
                                        'template' => "{label}\n{beginWrapper}\n{input}\n{hint}\n{error}\n{endWrapper}",
                                        'horizontalCssClasses' => [
                                            'label' => 'col-sm-2',
                                            'wrapper' => 'col-sm-7',
                                            'error' => '',
                                        ],
                                     ],
                                ]); ?>

    <?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'role')->dropDownList(Yii::$app->params['role']) ?>

    <?= $form->field($model, 'group_num')->widget(Select2::classname(), [
            'language' => 'zh-cn',
            'options' => ['multiple'=>true,'placeholder' => '团号'],
            'showToggleAll' => false,
            'pluginOptions' => [
                'allowClear' => true,
                'tags' => true,
            ],
    ]) ?>
  
    
    <?= $form->field($model, 'status')->inline(true)->radioList(\Yii::$app->params['status']) ?>

    <div class="form-group text-center">
        <?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
